<?php
	//单行注解
	/*
	 多行注解
	 */
	print("微信开发平台demo1")."<br/>";
	print "微信开发平台demo2"."<br/>";
	echo print "微信开发平台demo3";
	$a = "今天";
	$b = 10;
	printf("%s买了本%u书",$a,$b);
	printf("%s买了本%u书",$a,$b)."<br/>";
	echo "aaaa";
	echo sprintf("%s买了本%u书",$a,$b)."<br/>";
	$c = sprintf("%s买了本%u书",$a,$b);
	printf($c);
	printf("这是%s",$c)."<br/>";
	echo "<br/>";
	printf("%b",$b)."<br/>";
	$a1 = 33;
	$b1 = &$a1;
	$b1 = 88;
	echo "a1:".$a1."<br>";
	echo "b1:".$b1;
	function local(){
		$a2 = "inner function";
		echo "inner function variable:".$a2."<br>";
	}
	local();
	$a2 = "outer function";
	echo "outer function variable:".$a2;
	$a3 = "This is outer function";
	function local1(){
		global $a3;
		echo "invoke in inner function:".$a3."<br>";
	}
	local1();
	$a4 = "This is outer function2";
	function local2(){
		global $a4;
		$a4 = "This is inner funtion2";
	}
	local2();
	echo "在local2函数外获得变量a4的值为：".$a4."<br>";
	function add(){
		static $a = 0;
		$a++;
		echo $a."<br>";
	}
	add();
	add();
	add();
	$a = "hello";
	$$a = "world";
	echo $a."<br>";
	echo $$a."<br>";
	echo $hello."<br>";
	echo "$a {$$a}"."<br>";
	echo "$a $hello"."<br>";
	$a = 100;
	$b = -034;
	$c = 0xBF;
	echo $a."<br>";
	echo $b."<br>";
	echo $c."<br>";
	$a = true;
	$b = false;
	echo $a."<br>";
	echo $b."<br>";
	$var = "中国人";
	echo "我是$var"."<br>";
	echo '我是$var'.'<br>';
	echo "今天天气很好"."<br>";
	echo '我们去图书馆'.'<br>';
	echo <<<Eof
			我是一个{$var}\taaa<><br>
Eof;
	$str = "年轻人";
	//echo "我们都是$str，应该好好学习。"."<br>";
	echo "我们都是{$str}，应该好好学习。"."<br>";
	echo "我们都是".$str."应该好好学习。"."<br>";
	//数组
	/*
	$network = array(1=>"how",2=>are,"three"=>"you");
	echo $network[three];
	*/
	class Book {
		function getBookName($book_name){
			return $book_name;
		}
	}
	$book1 = new Book();
	echo $book1->getBookName("PHP")."<br>";
	$book2 = new Book();
	echo $book2->getBookName("JSP");
	//过时
	/*
	$cn = mysql_connect('localhost','root');
	echo get_resource_type($cn)."<br>";
	*/
	$a = 1 + 1.23;
	$b = 2 + "3.14";
	$c = 3 + "abc";
	echo $a."<br>";
	echo $b."<br>";
	echo $c."<br>";
	$b = 3.1;
	$c = TRUE;
	var_dump($b,$c);
	$a = array (1, 2, array ("a", "b", "c"));
	var_dump ($a);
	$a = "5.6kg";
	$b = true;
	settype($a, "float");
	settype($b, "string");
	echo $a."<br>";
	echo $b."<br>";
	$a = "5.6kg";
	$b = 2001;
	$c = intval($a);
	$d = floatval($a);
	$e = strval($b);
	echo $a."<br>";
	echo $b."<br>";
	echo $c."<br>";
	echo $d."<br>";
	echo $e."<br>";
	$a = "大家好";
	$b = 3.14;
	$c = 9;
	$d = array(2,4,6);
	echo var_dump($a)."<br>";
	echo var_dump($b)."<br>";
	echo var_dump($c)."<br>";
	echo var_dump($d)."<br>";
	echo var_export($a)."<br>";
	echo var_export($b)."<br>";
	echo var_export($c)."<br>";
	echo var_export($d)."<br>";
	define("CONSTANT","您好");
	echo CONSTANT."<br>";
	$a = "今天";
	$b = $a."是星期五";
	echo $b."<br>";
	$c = "明天";
	$c.="是星期六";
	echo $c."<br>";
	$a = 5;
	$b = 0;
	$c = 1;
	//错误抑制运算符
	echo @($a/$b);
	echo @($a/$c);
	$egit = "http://wiki.eclipse.org/EGit/FAQ#Where_can_I_find_older_releases_of_EGit.3F";
	echo "egit-url: ".$egit."<br>";
	class A{}
	$a = new A();
	var_dump($a instanceof A);
	//执行运算符
	$a = `dir c:\\Drivers`;
	echo $a;
?>